DIR    ?= $(shell pwd)
PREFIX ?=$(PWD)/out/third

NAME   := termcap-1.3.1

HOST   ?= aarch64-linux
ifeq ($(findstr $(CROSS), aarch64), )
    HOST := arm-linux
endif

default: clean
	make install

clean:
	@echo "cleanning" ; rm -rf $(NAME)

unpack:
	@echo "unpacking" ; test -z $(NAME) || tar -xvf $(NAME).tar.gz

dopatch: unpack
	@# do nothing

config: dopatch
	cd $(NAME)   \
		&& ./configure \
		--host=$(HOST) \
		--prefix=$(PREFIX)/ \
		CC=$(CROSS)gcc \
		--disable-debug \
		--enable-shared --without-x --disable-gdbtk --disable-tui --without-include-regex --without-include-gettext \
		
build: config
	make -C $(NAME) CC=$(CROSS)gcc CXX=$(CROSS)g++ AR=$(CROSS)ar
	
install: build
	test -z $(PREFIX) || mkdir -p $(PREFIX)
	make -C $(NAME) install CC=$(CROSS)gcc CXX=$(CROSS)g++ AR=$(CROSS)ar

help:
	@echo "make CROSS=toolchain"
	
	
